/* eslint-disable quotes */
'use strict';

const OldProcessor = require('./lib/old_processor');
const NewProcessor = require('./lib/new_processor');
const FilterProcessor = require('./lib/filter_processor');
// const SeminarProcessor = require('./lib/seminar_processor');

const minimist = require('minimist');
const argv = minimist(process.argv.splice(2));
console.log(argv);
const filePath = argv.filepath;
// const filePath = '/Users/steve.k.you/Downloads/新旧栏目导数据关系映射-核对版（20200113）.xlsx';
// const ztFilePath = '/Users/marshall.x.cai/Documents/专题信息.xlsx';
// const ztTransPath = '/Users/marshall.x.cai/Documents/[SeminarProcessor]专题信息.xlsx';
// const filePath = '/Users/youkai/Documents/官网/新旧栏目导数据关系映射(1).xlsx';

const oldProcessor = new OldProcessor(filePath);
// const seminarProcessor = new SeminarProcessor(ztFilePath);
// const ztFilterProcessor = new FilterProcessor(ztTransPath);
oldProcessor
  .process()
  .then(outputFile => {
    const newProcessor = new NewProcessor(outputFile);
    return newProcessor.process(outputFile);
  })
  .then(outputFile => {
    const filterProcessor = new FilterProcessor(outputFile);
    return filterProcessor.process(outputFile);
  })
  .then(outputFile => {
    console.log(`final file : ${outputFile}`);
  })
  .catch(err => {
    console.log(err);
  })
  .finally(() => {
    process.exit(0);
  });

// seminarProcessor.process().
//   then(outputFile => {
//     console.log(`final file : ${outputFile}`);
//   })
//   .catch(err => {
//     console.log(err);
//   })
//   .finally(() => {
//     process.exit(0);
//   });

// ztFilterProcessor.process().
//   then(outputFile => {
//     console.log(`final file : ${outputFile}`);
//   })
//   .catch(err => {
//     console.log(err);
//   })
//   .finally(() => {
//     process.exit(0);
//   });
